package extreme.refactor.gilded_rose;

public class Aged extends Item {

    public Aged(String name, Integer sellIn, Integer quanlity) {
        super(name, sellIn, quanlity);
    }

    public static Item getAged(Item items) {

        if (items.sellIn > 0) {
            items.sellIn = items.sellIn - 1;
            items.quanlity = items.quanlity + 1;
        } else if (items.sellIn <= 0) {
            items.sellIn = items.sellIn - 1;
            items.quanlity = items.quanlity + 2;
        }
        if (items.quanlity >= 50) {
            items.quanlity = 50;
        }

        return items;
    }
}
